package test;

import java.util.Scanner;

public class MeiTuan3 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] nums = new int[n];
        for (int i = 0; i < n; i++) {
            nums[i] = scanner.nextInt();
        }
        int[] numsb = new int[n];
        for (int i = 0; i < n; i++) {
            numsb[i] = compute(nums[i],i + 1, n);
        }
        int sum = numsb[0];
        for (int i = 1; i < n; i++) {
            sum = sum ^ numsb[i];
        }
        System.out.println(sum);
    }

    private static int compute(int a, int i, long n) {
        int sum = a;
        for (int j = 1; j <= n; j++) {
            sum = sum ^ (i % j);
        }
        return sum;
    }
}
